package com.aspose.cells;

import java.util.Iterator;

class zrb {
   private Workbook a;
   private com.aspose.cells.b.a.d.zo b;

   public zrb(Workbook var1) {
      this.a = var1;
   }

   public void a(com.aspose.cells.b.a.d.zm var1) throws Exception {
      this.b = new com.aspose.cells.b.a.d.zo(var1, this.a.getSettings().f());
      this.a();
      this.b.c();
   }

   void a() throws Exception {
      Cells var1;
      if (zsu.a(this.a.getWorksheets())) {
         var1 = this.a.getWorksheets().get(0).getCells();
      } else {
         var1 = this.a.getWorksheets().get(this.a.getWorksheets().getActiveSheetIndex()).getCells();
      }

      int var2 = var1.getMaxRow();
      int var3 = var1.getMaxDataColumn();
      this.b.c("TABLE");
      this.b.c("0,1");
      this.b.c("\"EXCEL\"");
      this.b.c("VECTORS");
      this.b.c("0," + (var2 + 1));
      this.b.c("\"\"");
      this.b.c("TUPLES");
      this.b.c("0," + (var3 + 1));
      this.b.c("\"\"");
      this.b.c("DATA");
      this.b.c("0,0");
      this.b.c("\"\"");
      int var4 = -1;

      for(int var5 = 0; var5 < var1.getRows().getCount(); ++var5) {
         Row var6 = var1.getRows().getRowByIndex(var5);
         this.a(var4, var6.getIndex(), var3);
         var4 = var6.getIndex();
         this.b.c("-1,0\r\nBOT");
         int var7 = -1;

         Cell var9;
         for(Iterator var8 = var6.iterator(); var8.hasNext(); var7 = var9.getColumn()) {
            var9 = (Cell)var8.next();
            this.a(var7, var9.getColumn());
            switch(var9.getType()) {
            case 0:
               this.b.c("0,1");
               this.b.c(var9.getBoolValue() ? "TRUE" : "FALSE");
               break;
            case 1:
            case 4:
               this.b.c("0," + var9.j());
               this.b.c("V");
               break;
            case 2:
               this.b.c("0,0");
               this.b.c("ERROR");
               break;
            case 3:
            case 5:
               this.b.c("1,0");
               this.b.c("\"" + var9.j() + "\"");
            }
         }

         this.a(var7, var3 + 1);
      }

      this.b.c("-1,0");
      this.b.c("EOD");
   }

   void a(int var1, int var2, int var3) throws Exception {
      ++var1;

      while(var1 < var2) {
         this.b.c("-1,0\r\nBOT");
         this.a(-1, var3 + 1);
         ++var1;
      }

   }

   void a(int var1, int var2) throws Exception {
      ++var1;

      while(var1 < var2) {
         this.b.c("1,0");
         this.b.c("\"\"");
         ++var1;
      }

   }
}
